package com.ruoyi.net.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.net.domain.PerformanceListVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.net.mapper.PerformanceMapper;
import com.ruoyi.net.domain.Performance;
import com.ruoyi.net.service.IPerformanceService;

/**
 * 性能管理-性能Service业务层处理
 * 
 * @author tony
 * @date 2024-12-19
 */
@Service
public class PerformanceServiceImpl implements IPerformanceService {
    @Autowired
    private PerformanceMapper performanceMapper;

    /**
     * 查询性能管理-性能
     *
     * @param id 性能管理-性能主键
     * @return 性能管理-性能
     */
    @Override
    public Performance selectPerformanceById(String id) {
        return performanceMapper.selectPerformanceById(id);
    }

    /**
     * 查询性能管理-性能列表
     *
     * @param performance 性能管理-性能
     * @return 性能管理-性能
     */
    @Override
    public List<PerformanceListVo> selectPerformanceList(Performance performance) {
        return performanceMapper.selectPerformanceList(performance);
    }

    /**
     * 新增性能管理-性能
     *
     * @param performance 性能管理-性能
     * @return 结果
     */
    @Override
    public int insertPerformance(Performance performance) {
        String uuid = IdUtils.simpleUUID();
        if (StringUtils.isEmpty(performance.getId())) {
            performance.setId(uuid);
        }
        performance.setCreateBy(SecurityUtils.getUsername());
        performance.setCreateTime(DateUtils.getNowDate());
        performance.setUpdateBy(SecurityUtils.getUsername());
        performance.setUpdateTime(DateUtils.getNowDate());
        return performanceMapper.insertPerformance(performance);
    }

    /**
     * 修改性能管理-性能
     *
     * @param performance 性能管理-性能
     * @return 结果
     */
    @Override
    public int updatePerformance(Performance performance) {
        performance.setUpdateBy(SecurityUtils.getUsername());
        performance.setUpdateTime(DateUtils.getNowDate());
        return performanceMapper.updatePerformance(performance);
    }

    /**
     * 批量删除性能管理-性能
     *
     * @param ids 需要删除的性能管理-性能主键
     * @return 结果
     */
    @Override
    public int deletePerformanceByIds(String[] ids) {
        return performanceMapper.deletePerformanceByIds(ids);
    }

    /**
     * 删除性能管理-性能信息
     *
     * @param id 性能管理-性能主键
     * @return 结果
     */
    @Override
    public int deletePerformanceById(String id) {
        return performanceMapper.deletePerformanceById(id);
    }

    /**
     * 批量新增性能管理-性能
     *
     * @param performances 性能管理-性能列表
     * @return 结果
     */
    @Override
    public int insertPerformances(List<Performance> performances) {
        return performanceMapper.insertPerformances(performances);
    }
}